// 建立goEasy链接
const goEasyConfig = {
  connect() {
    //建立连接
    this.$goeasy.connect({
      id: "user001", //pubsub选填，im必填
      data: { avatar: "/www/xxx.png", nickname: "Neo" }, //必须是一个对象，pubsub选填，im必填，用于上下线提醒和查询在线用户列表时，扩展更多的属性
      onSuccess: function() {
        //连接成功
        console.log("连接成功");
      },
      onFailed: function(error) {
        //连接失败
        console.log("连接失败:" + error.code + ",error:" + error.content);
      },
      onProgress: function(attempts) {
        //连接或自动重连中
        console.log("连接或自动重连中", attempts);
      },
    });
  },
  //断开连接
  disconnect() {
    goeasy.disconnect({
      onSuccess: function() {
        console.log("断开链接成功");
      },
      onFailed: function(error) {
        console.log("断开链接失败" + error.code + ",error:" + error.content);
      },
    });
  },
};

export default goEasyConfig;
